<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        window.addEventListener('load',function(){
            var btn1 = document.querySelector('.btn1');
            btn1.onclick = function(){
                alert("警告框");
            }
            
            var btn2 = document.querySelector('.btn2');
            btn2.onclick = function(){
                confirm("确认框");
            }

            var btn3 = document.querySelector('.btn3');
            btn3.onclick = function(){
                prompt("提示框");
            }
        })
    </script>

    <button class = "btn1">测试按钮1</button>
    <button class = "btn2">测试按钮2</button>
    <button class = "btn3">测试按钮3</button>
</body>
</html>